<template>
  <div class>
    <header class="headercont">
      <section class="headermain">
        <ul class="headerleft">
          <li class="leftlist">
            <router-link to="home">
              <img
                v-if="lan === 'English'"
                :src="require('_img/logoen.png')"
                alt="PPEX"
              />
              <img v-else :src="require('_img/logo.png')" alt="PPEX" />
            </router-link>
          </li>
          <li class="leftlist">
            <router-link to="home">
              <p>{{ $t("header.route[0]") }}</p>
            </router-link>
          </li>
          <li class="leftlist" v-if="false">
            <router-link to="contract">
              <p>{{ $t("header.route[1]") }}</p>
            </router-link>
          </li>
          <li class="leftlist">
            <router-link to="transaction">
              <p>{{ $t("header.route[2]") }}</p>
            </router-link>
          </li>
          <li class="leftlist">
            <el-dropdown>
              <a href="javascript:void(0);">
                <p>{{ $t("header.add[0]") }}
                  <i class="el-icon-arrow-down"></i>
                </p>
              </a>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <router-link to="fabimatch" class="meeee">快捷买币</router-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <router-link to="fabitransaction" class="meeee">自选买币</router-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </li>
          <li class="leftlist" :class="{ active: headertype == 8 }" v-if="false">
            <router-link to="extension">
              <p>{{ $t("header.add[1]") }}</p>
            </router-link>
          </li>
          <li class="leftlist" v-if="false">
            <router-link to="newsflash">
              <p>{{ $t("header.route[3]") }}</p>
            </router-link>
          </li>
        </ul>
        <ul class="headerright">
          <li class="rightlist">
            <router-link to="login">
              <el-button type="primary">{{ $t("header.route[12]") }}</el-button>
            </router-link>
          </li>
          <li class="rightlist" v-if="false">
            <router-link to="register">
              <el-button>{{ $t("header.route[11]") }}</el-button>
            </router-link>
          </li>
          <li class="rightlist" v-if="false">
            <div class="yuyan">
              <el-dropdown @command="changeLangEvent">
                <span class="el-dropdown-link">
                  {{ lan }}
                  <i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown">
                  <el-dropdown-item command="zh">简体中文</el-dropdown-item>
                  <el-dropdown-item command="en">English</el-dropdown-item>
                  <!-- <el-dropdown-item command="tw">繁體中文</el-dropdown-item> -->
                  <!-- <el-dropdown-item command="ja">日本語</el-dropdown-item> -->
                  <!-- <el-dropdown-item command="ko">한국어</el-dropdown-item> -->
                </el-dropdown-menu>
              </el-dropdown>
            </div>
          </li>
        </ul>
      </section>
    </header>
    <div class="loginmain">
      <router-view />
    </div>
    <footer class="footercont">
      <section class="footermain">
        <p class="text">© 2017 - 2020 PPEX All rights reserved</p>
      </section>
    </footer>
  </div>
</template>

<script>
import { content } from "@/api/software";

export default {
  name: "loginmain",
  data() {
    return {
      lan: "English",
    };
  },
  methods: {
    changeLangEvent(e) {
      let lan = localStorage.getItem("lang");
      if (lan && lan == e) {
        return;
      }
      localStorage.setItem("lang", e);
      this.lang = e;
      this.$i18n.locale = this.lang; //关键语句
      this.$router.go(0);
    },
  },
  created() {
    let la = localStorage.getItem("lang");
    if (la) {
      if (la == "zh") {
        this.lan = "简体中文";
      } else if (la == "tw") {
        this.lan = "繁體中文";
      } else if (la == "ja") {
        this.lan = "日本語";
      } else if (la == "ko") {
        this.lan = "한국어";
      } else {
        this.lan = "English";
      }
    }
    content()
      .then((res) => {
      
      })
      .catch((err) => {
       
      });
  },
};
</script>
